@extends('pc_admin.app')

@section('content')
    <link rel="stylesheet" href="/css/pc-system/pay-page.css">
    <div class="mian-container">
        <div class="container-section pay-page">
            <div class="content">
                {{--<h5>{{$name}}</h5>--}}
                <p class="title">实付金额：<span class="money">￥{{$price}}</span></p>
                <p class="cnt">请在24小时内完成支付，否则可能导致购买失败</p>
                <div class="codeArea">
                    {!! $paycade !!}
                    <div class="tips clearfix">
                        <img src="http://nos.netease.com/test-edu-image/8649B4237712409B2C7F605C74CD1435.png" class="tipsimg">
                        <div class="ctips">请使用微信扫描<br>二维码以完成支付</div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <script>
        setInterval("checkPay()", 10000);
        function checkPay() {
            $.ajax({
                type: "POST",
                url: "/checkpay",
                async: true,
                data: "sn={{$order_sn}}",
                success: function (data) {
                    if (data.status =='success') {
                        layer.msg(data.msg);
                        rehref();
                    }
                    if (data.status == false) {
                        //layer.msg(data.msg);
                    }
                }
            });
        }

        function rehref() {
            $('.codeArea').replaceWith('<h2 class="paysuccess">购买成功！！！</h2>');
            setInterval(window.location.href = "/buy-vip", 4000);

        }
    </script>
@endsection
